//
//  XGL_UserDataView.swift
//  XGamesLive
//
//  Created by ios on 2024/5/20.
//

import UIKit

class XGL_UserDataView: UIView {

    var nameText: UILabel!
    var idText: UILabel!
    var headerView: UIImageView!
    var genderIconView: UIImageView!
    var fansItem: XGL_PersonalInforNumberItem!
    var followItem: XGL_PersonalInforNumberItem!
    var giftsItem: XGL_PersonalInforNumberItem!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.nameText = UILabel().then({ make in
            make.textColor = UIColor.white
            make.font = UIFont.pingfangSC_Semibold(fontSize: 24.0)
        })
        self.idText = UILabel().then({ make in
            make.textColor = UIColor.hexColor("#A5A5A5")
            make.font = UIFont.pingfangSC_Regular(fontSize: 14.0)
        })
        self.headerView = UIImageView().then({ make in
            make.layerCornerRadius = 33.0
            make.clipsToBounds = true
            make.layerBorderColor = UIColor.hexColor("#80FFE6")
            make.layerBorderWidth = 1.5
        })
        self.genderIconView = UIImageView()
        self.fansItem = XGL_PersonalInforNumberItem().then({ make in
            make.subtitle = "Fans"
            make.title = "0"
            
        })
        self.followItem = XGL_PersonalInforNumberItem().then({ make in
            make.subtitle = "Follow"
            make.title = "0"
           
        })
        self.giftsItem = XGL_PersonalInforNumberItem().then({ make in
            make.subtitle = "Gifts"
            make.title = "0"
            
        })
        let line = UIView().then { make in
            make.backgroundColor = UIColor.hexColor("#80FFE6")
        }
        self.addSubviews([nameText,idText,headerView,genderIconView,fansItem,followItem,giftsItem,line])
        
        nameText.snp.makeConstraints { make in
            make.left.equalTo(15.0)
            make.top.equalTo(conversionWithScrennWidth(value: 40.0))
            make.right.equalTo(headerView.snp.left).offset(-10.0)
        }
        headerView.snp.makeConstraints { make in
            make.top.equalTo(conversionWithScrennWidth(value: 30.0))
            make.width.height.equalTo(66.0)
            make.right.equalTo(-40.0)
        }
        idText.snp.makeConstraints { make in
            make.left.equalTo(nameText)
            make.top.equalTo(nameText.snp.bottom).offset(8.0)
        }
        genderIconView.snp.makeConstraints { make in
            make.bottom.right.equalTo(headerView)
            make.width.height.equalTo(18.0)
        }
        fansItem.snp.makeConstraints { make in
            make.left.equalTo(15.0)
            make.top.equalTo(idText.snp.bottom).offset(conversionWithScrennWidth(value: 33.0))
        }
        followItem.snp.makeConstraints { make in
            make.centerY.equalTo(fansItem)
            make.left.equalTo(fansItem.snp.right).offset(conversionWithScrennWidth(value: 37.0))
        }
        giftsItem.snp.makeConstraints { make in
            make.centerY.equalTo(fansItem)
            make.left.equalTo(followItem.snp.right).offset(conversionWithScrennWidth(value: 37.0))
        }
        line.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.height.equalTo(1.0)
            make.width.equalTo(50.0)
            make.top.equalTo(followItem.snp.bottom).offset(24.0)
        }
        self.snp.makeConstraints { make in
            make.bottom.equalTo(line.snp.bottom)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
